<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>找回密码 - ${site.name} - Powered by JEECMS</title>
<script src="${resSys}/jquery.js" type="text/javascript"></script>
<script src="${resSys}/front.js" type="text/javascript"></script>

<link type="text/css" rel="stylesheet" href="/${res}/css/index.css" />

<!--[if lt IE 9]> 
<script src="/${res}/js/html5shiv.min.js"></script>
<script src="/${res}/js/respond.min.js"></script>
<![endif]-->

<script type="text/javascript">
function isPoneAvailable(str) {  
    var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;  
    if (!myreg.test(str)) {  
        return false;  
    } else {  
        return true;  
    }  
}  
function guestbookCaptcha(){
	$("#captcha").click();
}
$(function() {
	$("#jvForm").validate();
	$("#captcha").click();
	$("#getMobileCode").bind("click", function(){
        var mobile = $("#mobile").val();
    		// 判断手机号码
        if($.trim($('#username').val()).length == 0){
        	alert('请输入用户名！\n');
        }else if ($.trim($('#mobile').val()).length == 0) { 
	         alert('手机号没有输入\n');
	         $('#mobile').focus();
        }else if(!isPoneAvailable(mobile)){
     	   alert("请输入正确的手机号码！\n");
        }else if($.trim($('#vCode').val()).length == 0){
     	   alert("请输入验证码！\n");
        }else if($.trim($('#vCode').val()).length != 4){
     	   alert("请输入正确的验证码！\n");
        }else{
     	   $.ajax({
     	        type:"POST",
     	        url:"${base}/sms/send_register_msg.jspx",
     	         data:{
     	        	mobilePhone:$("#mobile").val(),
     	        	smsSendType:2,
     	        	username:$("#username").val(),
     	        	vCode:$("#vCode").val()
     	        },
     	        dataType:"json",     
     	        success:function(data){
     	        	if(data.code ==200){
     	        		alert("发送成功！\n");
     	        	}else if(data.code == 356){
     	            	alert("该手机号已达到每日上限！\n");        	        		
     	        	}else if(data.code ==357){
     	        		alert("该手机号已被绑定！\n");
     	        	}else if(data.code ==354){
     	        		alert("发送短信间隔过短！\n");
     	        	}else if(data.code ==301){
     	        		alert("用户不存在！\n");
     	        	}else if(data.code ==360){
     	        		alert("用户未设置手机号！\n");
     	        	}else if(data.code ==361){
     	        		alert("手机号不匹配！\n");
     	        	}else if(data.code ==353){
     	        		guestbookCaptcha()
    	        		alert("验证码错误！\n");
    	        	}else if(data.code ==101){
    	        		guestbookCaptcha()
    	        		alert("验证码已失效！\n");
    	        	}else if(data.message =="sms_error"){
    	        		alert("短信请求错误，请联系本站管理员！\n");
    	        	}else {
     	        		alert(data.message);
     	        	}
     	        },
     	        error:function(jqXHR){
     	            
     	        }
     	    });
        } 
      });
});
</script>

</head>

<body style="background-color:#f7f7f7;">
[#include "../include/top.html"/]
[#include "../include/header.html"/] 
<div class="register-box" style="height:320px;"> 
  <div class="register-nav"><span>找回密码</span><div class="register-login">没有账号，<a class="tc" href="${base}/register.jspx">立即注册 ></a></div></div> 
  <form id="jvForm" action="forgot_password.jspx" method="post">
  <div class="register-list">    
    <ul>
      <li><span>用户名</span><input type="text" id="username" name="username" class="register-input" placeholder="请输入注册账号" /></li>
      [#if isSMSForgotPassword == 0]
      <li><span>电子邮箱</span><input type="text" id="email" name="email" maxlength="30" placeholder="请输入注册邮箱" class="register-input" /></li>
      <li><span>验证码</span><input type="text" maxlength="20" id="captcha" name="captcha" class="register-input register-code" /><i class="code-img"><img src="${base}/captcha.svl" id="captcha" onclick="this.src='${base}/captcha.svl?d='+new Date()*1"></i></li>
      [/#if]
      [#if isSMSForgotPassword == 1]
      <li><span>手机号码</span><input type="text" id="mobile" name="mobile" maxlength="30" placeholder="请输入注册手机号" class="register-input" /></li>
      <li><span>验证码</span><input type="text" maxlength="20" id="vCode" name="vCode" class="register-input register-code" /><i class="code-img"><img src="${base}/captcha.svl" id="captcha" onclick="this.src='${base}/captcha.svl?d='+new Date()*1"></i></li>
      <li><span>校验码</span><input type="text" maxlength="20" id="captcha" name="captcha" class="register-input register-code" /><i class="code-img"><a id="getMobileCode">获取验证码</a></i></li>
      [/#if]
      <li class="register-btn">
      <input type="hidden" name="token"  value="${token!}" />
      <input type="submit" name="register" value="提 交" />
      </li>
    </ul>
  </div>
  </form>
</div>
[#include "../include/footer.html"/]
[#include "../include/right-fixed.html"/]
</body>
</html>
